Fix races in the Makefile of plugins/sudoers when compiled in parallel.#487
Open
shankerwangmiao wants to merge 3 commits intosudo-project:mainfrom
Open
Fix races in the Makefile of plugins/sudoers when compiled in parallel.#487shankerwangmiao wants to merge 3 commits intosudo-project:mainfrom
shankerwangmiao wants to merge 3 commits intosudo-project:mainfrom
Conversation
in order to prevent the command from continuing to execute when one of the commands fails.
When one command generates multiple outputs, using a naive one-to-two depency would introduce race condition when doing parallel compilation. For example, when the rules are written in this pattern: foo.c foo.h: foo.y command foo.y generating foo.c and foo.h some-target: foo.c some command reading foo.c some-other-target: foo.h some command reading foo.h and the targets are built in parallel, `command foo.y` may be executed twice because make thinks `command foo.y` can be used to generate foo.c and can also be used to generate foo.h. What's worse, one of the commands reading foo.c or foo.h may read an incomplete input during the command generating the other one is running. This pattern happens on the rules of def_data.in and gram.y. This commit fixes this by using a stamp file to witness the execution of the `command foo.y`, following the advice in the automake manual [1]. [1]: https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html
The targets for generating getdate.c and gram.c/h run yacc in the same directory and post-process the generated y.tab.c/h by yacc into the final target. They both generate temporary y.tab.c/h files with the same name and they may overwrite each other if built in parallel. This commit fixes this by let yacc run in individual temporary directories to prevent them from overwriting each other.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.